//
//  SLBottomNextStepButton.m
//  SulitLoanDemo
//
//  Created by 虞嘉伟 on 2025/2/22.
//

#import "SLBottomNextStepButton.h"
#import <YYKit.h>
#import <Masonry.h>


@implementation SLBottomNextStepButton

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = UIColorHex(#FDC5E0);
        [self addSubview:self.nextStepButton];
        [self.nextStepButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self).inset(35);
            make.top.equalTo(self).inset(11);
            make.height.mas_equalTo(54);
        }];
    }
    return self;
}


- (void)nextStepButtonAction:(UIButton *)button {
    !self.nextStepButtonCallback ?: self.nextStepButtonCallback();
}

- (UIButton *)nextStepButton {
    if (!_nextStepButton) {
        _nextStepButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_nextStepButton setTitle:@"Next Step" forState:UIControlStateNormal];
        _nextStepButton.titleLabel.font = aspectDefaultFont(16);
        _nextStepButton.backgroundColor = UIColorHex(#1B1B1B);
        _nextStepButton.layer.cornerRadius = 20;
        _nextStepButton.layer.borderColor = UIColorHex(#1B1B1B).CGColor;
        _nextStepButton.layer.borderWidth = 1;
        [_nextStepButton addTarget:self action:@selector(nextStepButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _nextStepButton;
}

@end
